<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>margin负值运用</title>
    <style>
        ul li{
            position: relative;
            float: left;
            list-style: none;
            width: 200px;
            height: 200px;
            border: 1px solid red;
            margin-left: -1px;
        }
        /* ul li:hover{
                1、如果盒子没有定位，则鼠标鼠标经过添加相对定位即可
            position: relative;
            border: 1px solid blue;
        } */
        ul li:hover{
                /* 2.如果li中都有定位，则利用z-index提高层级 */
            z-index: 1;
            border: 1px solid blue;
        }
    </style>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
    <br>
    <img src="img/margin负值运用.png" alt="">
</body>
</html>